﻿<Window xmlns:UI="clr-namespace:Pdf2epub.UI"  x:Class="Pdf2epub.UI.TableDetectionConfigurator"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        Title="Table Detection Configurator" 
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Height="600" 
        Width="800" 
        Icon="/Pdf2epub;component/app.ico" 
        ShowInTaskbar="False">

    <Window.CommandBindings>
        <CommandBinding Command="UI:TableDetectionConfiguratorCommands.RenderPage" CanExecute="RenderPageCanExecute" Executed="OnCommandExecuted" />
    </Window.CommandBindings>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" MinWidth="150" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <DockPanel Grid.Column="0" LastChildFill="True" Margin="3">
            
            <Label DockPanel.Dock="Top" Content="Allowed baseline offset" />
            <xctk:DoubleUpDown 
                Margin="3" 
                DockPanel.Dock="Top" 
                Value="{Binding ProjectContext.ProjectConfiguration.TableDetectionAllowedBaselineOffset}" 
                FormatString="F2" 
                Minimum="0" 
                Maximum="50"
                Increment="0.1" />

            <Label DockPanel.Dock="Top" Content="Minimum cell size" />
            <xctk:DoubleUpDown 
                Margin="3" 
                DockPanel.Dock="Top" 
                Value="{Binding ProjectContext.ProjectConfiguration.MinTableCellSize}" 
                FormatString="F2" 
                Minimum="0" 
                Maximum="50" 
                Increment="0.1" />
            
            <Label DockPanel.Dock="Top" Content="Minimum row distance" />
            <xctk:DoubleUpDown 
                Margin="3" 
                DockPanel.Dock="Top" 
                Value="{Binding ProjectContext.ProjectConfiguration.TableDetectedMinRowDistance}" 
                FormatString="F2" 
                Minimum="0" 
                Maximum="50" 
                Increment="0.1" />

            <Label DockPanel.Dock="Top" Content="Cell Fuzzyness" />
            <xctk:DoubleUpDown 
                Margin="3" 
                DockPanel.Dock="Top" 
                Value="{Binding ProjectContext.ProjectConfiguration.TabeDetectedCellFuzzyness}" 
                FormatString="F2" 
                Minimum="0" 
                Maximum="50"
                Increment="0.1" />

            <Label DockPanel.Dock="Top" Content="Page to preview" />
            <xctk:SingleUpDown 
                Margin="3" 
                DockPanel.Dock="Top" 
                Name="nuPageToPreview"
                Minimum="1" 
                Maximum="{Binding ProjectContext.ProjectConfiguration.NumberOfPages}" />

            <Button Margin="3" DockPanel.Dock="Top" Command="UI:TableDetectionConfiguratorCommands.RenderPage">Extract from page</Button>

            <ListBox Margin="3" />
        </DockPanel>

        <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />

        <WebBrowser Name="webBrowser" Grid.Column="2" />
    </Grid>
</Window>
